import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import MainPageView from '../views/MainPageView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: MainPageView,
    children: [
      {
        path: '',
        name: 'home',
        component: HomeView
      },
      {
        path: '/categry',
        name: 'categry',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/CategoriesView.vue')
      },
      {
        path: '/cart',
        name: 'cart',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/ShopCart.vue')
      },
      {
        path: '/mine',
        name: 'mine',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/Mine.vue')
      }
    ]
  },
  {
    path:'/product',
    name:'product',
    component:()=>import('../views/ProductDetailView.vue')
  },
  {
    name: 'subList',
    path: '/subList',
    component: () => import('../views/SubListView.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/SearchView.vue')
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('../views/OrderList.vue')
  },
  {
    path: '/orderDetail',
    name: 'orderDetail',
    component: () => import('../views/OrderDetail.vue')
  }
  ,
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutMeView.vue')
  }
  
]

const router = new VueRouter({
  routes
})

export default router
